// jie_JUZHEN.cpp: implementation of the Cjie_JUZHEN class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "jie_JUZHEN.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

Cjie_JUZHEN::Cjie_JUZHEN()
{

}

Cjie_JUZHEN::~Cjie_JUZHEN()
{

}

void Cjie_JUZHEN::deJUZHEN()
{

	for(a=1,zi=97;a<6;a++)
for(b=1;b<6;b++)
{JU[a][b]=zi++;
JU1[a][b]=JU[a][b]-32;}
   


	CFindfile OPEN;
	//keycode1();
if((fp2=fopen("DECTYPT.txt","w"))==NULL)
{ 
	cout<<"cant open"<<endl;
    exit(0);
}


  OPEN.mopen();
  for(j=0;j<OPEN.i;j++)
  {
 if(OPEN.record[j]>='a'&&OPEN.record[j]<='z')

	  {	
		  for(a=1;a<6;a++)
for(b=1;b<6;b++)
{
	if(	OPEN.record[j]==JU[a][b])	 
     ZUOBIAO=JU[b][a];
    else if(OPEN.record[j]=='a')ZUOBIAO='z';
      else if(OPEN.record[j]=='z')ZUOBIAO='a';
	  }
 }

else if(OPEN.record[j]>='A'&&OPEN.record[j]<='Z')

	 { for(a=1;a<6;a++)
for(b=1;b<6;b++)
{
	if(	OPEN.record[j]==JU1[a][b])	 
ZUOBIAO=JU1[b][a];
else if(OPEN.record[j]=='A')ZUOBIAO='Z';
else if(OPEN.record[j]=='Z')ZUOBIAO='A';
	 }
}

	  else 
	  {
		  ZUOBIAO=OPEN.record[j];
	  }
      fputc(ZUOBIAO,fp2);
	  cout<<ZUOBIAO;
      
  } 
fclose(fp2);
cout<<endl;
}
